using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

class Program {
    static void Main(){
        Application.Run(new XMarksTheSpot());
    }
}

class XMarksTheSpot : Form {
    public XMarksTheSpot(){
        Text = "X Marks The Spot";
        BackColor = SystemColors.Window;
        ForeColor = SystemColors.WindowText;
        ResizeRedraw = true;
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        var g = e.Graphics;
        // drawX(g);
        // drawL(g);
        // drawBox(g);
        // drawSin(g);
        // drawRect(g);
        // drawT(g);
        // drawE(g);
        // drawArc(g);
        // drawRoundRect(g);
        drawPie(g);
    }

    void drawX(Graphics g){
        
        var pen = new Pen(ForeColor);

        g.DrawLine(pen,0,0,ClientSize.Width-1,ClientSize.Height-1);
        g.DrawLine(pen,0,ClientSize.Height-1,ClientSize.Width-1,0);
    }

    void drawL(Graphics g){
        var pen = new Pen(ForeColor);
        g.SmoothingMode = SmoothingMode.None;
        g.PixelOffsetMode = PixelOffsetMode.Default;
        g.DrawLine(pen,2,2,180,100);
    }

    void drawBox(Graphics g){
        Point[] apt = {
            new Point(2,2),
            new Point(180,2),
            new Point(180,100),
            new Point(2,100),
            new Point(2,2)
        };
        g.DrawLines(new Pen(ForeColor),apt);
    }

    void drawSin(Graphics g){
        var cx = ClientSize.Width;
        PointF[] aptf= new PointF[cx];
        for (int i = 0; i < cx; i++)
        {
            aptf[i].X = i;
            aptf[i].Y = i /2 *( 1 - (float)Math.Sin(i*2*Math.PI/(cx-1)));
        }
        g.DrawLines(new Pen(ForeColor),aptf);
    }

    void drawRect(Graphics g){
        g.DrawRectangle(new Pen(ForeColor),0,0,200,100);
    }

    void drawT(Graphics g){
        Point[] apt = {
            new Point(0,0),
            new Point(50,100),
            new Point(100,0)
        };
        g.DrawPolygon(new Pen(ForeColor),apt);
    }

    void drawE(Graphics g){
        g.DrawEllipse(new Pen(ForeColor),0,0,100,180);
    }

    void drawArc(Graphics g){
        var pen = new Pen(ForeColor);
        var rect = new Rectangle(0,0,ClientSize.Width,ClientSize.Height);
        for (int i = 0; i < 360; i+=15){
            g.DrawArc(pen,rect,i,10);
        }
    }

    void drawRoundRect(Graphics g){
        var pen = new Pen(ForeColor);
        var rect = new Rectangle(0,0,ClientSize.Width-1,ClientSize.Height-1);
        var size = new Size(ClientSize.Width/5,ClientSize.Height/5);
        g.DrawLine(pen,
            rect.Left+size.Width/2,
            rect.Top,
            rect.Right-size.Width/2,
            rect.Top
        );
        g.DrawArc(pen,
            rect.Right - size.Width,
            rect.Top,
            size.Width,size.Height,
            270,90
        );
        g.DrawLine(pen,
            rect.Right, rect.Top+size.Height/2,
            rect.Right,rect.Bottom-size.Height/2
        );
        g.DrawArc(pen,
            rect.Right - size.Width,
            rect.Bottom - size.Height,
            size.Width,size.Height,
            0,90
        );

        g.DrawLine(pen,
            rect.Right - size.Width/2,
            rect.Bottom,
            rect.Left+size.Width/2,
            rect.Bottom
        );
        g.DrawArc(pen,
            rect.Left,
            rect.Bottom - size.Height,
            size.Width,size.Height,
            90,90
        );
        g.DrawLine(pen,
            rect.Left, 
            rect.Bottom - size.Height/2,
            rect.Left,
            rect.Top+size.Height/2
        );
        g.DrawArc(pen,
            rect.Left,
            rect.Top,
            size.Width,size.Height,
            180,90
        );
    }

    void drawPie(Graphics g){

        var rect = new Rectangle(50,50,200,200);
        var pen = new Pen(ForeColor);
        int iTotal = 0;
        float fAngle = 0,fSweep;

        int[] values = {50,100,25,150,100,75};
        foreach(int v in values){
            iTotal = iTotal + v;
        }

        foreach(int v in values){
            fSweep = 360f*v/iTotal;
            g.DrawPie(new Pen(ForeColor),rect,fAngle,fSweep);
            fAngle = fAngle + fSweep;
        }

    }
}